﻿using B.S.DataBase.MyProject.Domain.SaleOrders;
using B.S.DataBase.MyProject.ErrorCode;
using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using T.E.ERP.Read.API.Applicantions.Command.MyOrdermementCommands;
using T.E.ERP.Read.API.Dtos.Dtos;

namespace T.E.ERP.Read.API.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class MyOrderMementController : ControllerBase
    {
        /// <summary>
        /// 中介者
        /// </summary>
        public readonly IMediator mediator;

        public MyOrderMementController(IMediator mediator)
        {
            this.mediator = mediator;
        }
        /// <summary>
        /// 采购订单列表
        /// </summary>
        /// <param name="OrderCode"></param>
        /// <returns></returns>
        [HttpGet]
        public async Task<APIResult<List<MyMementDTO>>> GetOrderMement(string? orderCode)
        {
            SalemementCommand command=new SalemementCommand();
            command.OrderCode = orderCode;
            return await mediator.Send(command);
        }
        /// <summary>
        /// 请购单
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public async Task<APIResult<List<JoinGetOrder>>> GetQingGou()
        {
            SelQinggouCommand command=new SelQinggouCommand();
            return await mediator.Send(command);
        }
        /// <summary>
        /// 销售订单
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public async Task<APIResult<List<ShouOrder>>> GetShouOrder()
        {
            ShouOrderCommand command=new ShouOrderCommand();
            return await mediator.Send(command);
        }
    }
}
